package com.itheima.exer.exercise.ex0925;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Period;
import java.time.format.DateTimeFormatter;

public class SetDate {
    public static void main(String[] args) {
        System.out.println("您的会员可以使用到2021年6月13号00:00:00");
        LocalDateTime nowTime = LocalDateTime.now();
        LocalDateTime dateTime = nowTime.withYear(2021).withMonth(6).withDayOfMonth(13).withHour(00).withMinute(00).withSecond(00);
        LocalDate localDate = nowTime.toLocalDate();
        LocalDate localDate1 = dateTime.toLocalDate();
        Period between = Period.between(localDate, localDate1);
        //DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        long l = between.toTotalMonths();
        System.out.println("您距离会员到期还有"+l+"个月");
    }
}
